public class FizzBuzz {
    private int number;

    public FizzBuzz(int num) {
        if (num < 1 || num > 100) {
            throw new IllegalArgumentException("数字必须在 1 - 100 范围内");
        }
        number = num;
    }
//

    public String fizzBuzz() {
        String numStr = String.valueOf(number);
        boolean divisibleBy3 = number % 3 == 0;
        boolean divisibleBy5 = number % 5 == 0;
        boolean contains3 = numStr.contains("3");
        boolean contains5 = numStr.contains("5");

        if ((divisibleBy3 && divisibleBy5) || (contains3 && contains5)) {
            return "FizzBuzz";
        } else if (divisibleBy3 || contains3) {
            return "Fizz";
        } else if (divisibleBy5 || contains5) {
            return "Buzz";
        } else {
            return numStr;
        }
    }
}
